/* Global styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* Main container - adapts to iframe or standalone */
.container {
    width: 100%;
    height: 450px; /* Default for iframe */
    position: relative;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
}

/* If opened in new tab, use 90vh */
body.standalone .container {
    height: 90vh;
}

/* Tooltip for header information */
.tooltip {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
}

.container:hover .tooltip {
    opacity: 1;
}

/* ADDED: Synopsis section styling to provide context */
.synopsis-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-bottom: 3px solid #5568d3;
}

.synopsis-content {
    max-width: 100%;
    text-align: center;
}

.synopsis-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.synopsis-text {
    color: #f0f4ff;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.synopsis-text strong {
    color: #fff;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Main content layout - three column design */
/* MODIFIED: Adjusted to account for synopsis section */
.main-content {
    display: flex;
    gap: 12px;
    padding: 10px;
    flex: 1;
    align-items: stretch;
    overflow: hidden;
}

/* Panel title styling */
.panel-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

/* Left panel - Available items */
.items-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.items-container {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    align-content: start;
}

/* Individual item styling */
.item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    user-select: none;
    min-height: 70px;
    justify-content: center;
}

.item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.item:active {
    cursor: grabbing;
}

.item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.item.packed {
    opacity: 0.3;
    pointer-events: none;
}

.item-icon {
    font-size: 28px;
}

/* MODIFIED: Increased font size from 11px to 14px for better readability */
.item-name {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #333;
    line-height: 1.2;
}

/* Center area - Backpack */
.backpack-area {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.backpack-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px dashed #ccc;
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    min-height: 200px;
}

.backpack-container.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.backpack-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.backpack-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.packed-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    justify-content: center;
    max-width: 100%;
}

.packed-item {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    position: relative;
    animation: popIn 0.3s ease;
}

.packed-item.incorrect {
    background: linear-gradient(135deg, #ffa07a 0%, #ff6b6b 100%);
    border-color: #f44336;
}

.packed-item-icon {
    font-size: 20px;
}

/* MODIFIED: Increased font size from 11px to 14px for packed item names */
.packed-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.remove-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #f44336;
    margin-left: 4px;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #f44336;
    color: white;
    transform: scale(1.1);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Progress section */
.progress-section {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.progress-label {
    font-weight: 600;
    color: #555;
}

.progress-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 12px;
}

/* Button container */
.button-container {
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.btn-check {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
    color: white;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 9, 121, 0.4);
}

.btn:active {
    transform: translateY(0);
}

/* Right panel - Feedback */
.feedback-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.feedback-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}

.instruction-text {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.categories-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-box {
    background: #f5f7fa;
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.category-box strong {
    color: #667eea;
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.category-box p {
    color: #666;
    font-size: 11px;
    margin: 0;
}

.feedback-message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
    animation: slideIn 0.4s ease;
}

.feedback-message.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.feedback-message.partial {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffeaa7;
}

.feedback-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

@keyframes slideIn {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.feedback-list {
    margin-top: 10px;
}

.feedback-list h4 {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 6px;
}

.feedback-list ul {
    list-style: none;
    padding-left: 0;
}

.feedback-list li {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-list li.correct {
    background: #d4edda;
    color: #155724;
}

.feedback-list li.incorrect {
    background: #f8d7da;
    color: #721c24;
}

.feedback-list li.missing {
    background: #fff3cd;
    color: #856404;
}

/* Scrollbar styling */
.items-container::-webkit-scrollbar,
.feedback-content::-webkit-scrollbar {
    width: 6px;
}

.items-container::-webkit-scrollbar-track,
.feedback-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.items-container::-webkit-scrollbar-thumb,
.feedback-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.items-container::-webkit-scrollbar-thumb:hover,
.feedback-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .items-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .backpack-icon {
        font-size: 40px;
    }
    
    /* ADDED: Adjust synopsis for mobile */
    .synopsis-title {
        font-size: 16px;
    }
    
    .synopsis-text {
        font-size: 12px;
    }
}